<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.2/css/all.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css">

<script class="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"littlefxc.github.io","root":"/","images":"/images","scheme":"Mist","version":"8.2.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}};
  </script>
<meta name="description" content="[TOC] 1 理论JVM-内存结构 JVM-类文件结构 JVM-类加载机制 JVM-分代收集理论 JVM-编译器优化 1.4 垃圾收集算法1.5 垃圾收集器2 工具虚拟机性能监控故障处理工具 3 实战3.1 大内存硬件上的程序部署策略如果实际内存有16G，将-Xmx和-Xms参数将Java 堆大小固定为12G，程序运行一段时间后，会常常不定期出现长时间失去响应，程序中涉及将磁盘中的文档提取到内存">
<meta property="og:type" content="article">
<meta property="og:title" content="JVM 调优">
<meta property="og:url" content="http://littlefxc.github.io/2021/02/23/docs/JVM/JVM-%E8%B0%83%E4%BC%98/index.html">
<meta property="og:site_name" content="一年春又来">
<meta property="og:description" content="[TOC] 1 理论JVM-内存结构 JVM-类文件结构 JVM-类加载机制 JVM-分代收集理论 JVM-编译器优化 1.4 垃圾收集算法1.5 垃圾收集器2 工具虚拟机性能监控故障处理工具 3 实战3.1 大内存硬件上的程序部署策略如果实际内存有16G，将-Xmx和-Xms参数将Java 堆大小固定为12G，程序运行一段时间后，会常常不定期出现长时间失去响应，程序中涉及将磁盘中的文档提取到内存">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-02-23T12:49:45.000Z">
<meta property="article:modified_time" content="2022-05-10T01:24:04.603Z">
<meta property="article:author" content="一年春又来">
<meta property="article:tag" content="jvm">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="http://littlefxc.github.io/2021/02/23/docs/JVM/JVM-%E8%B0%83%E4%BC%98/">


<script class="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>
<title>JVM 调优 | 一年春又来</title>
  




  <noscript>
  <style>
  body { margin-top: 2rem; }

  .use-motion .menu-item,
  .use-motion .sidebar,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header {
    visibility: visible;
  }

  .use-motion .header,
  .use-motion .site-brand-container .toggle,
  .use-motion .footer { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle,
  .use-motion .custom-logo-image {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line {
    transform: scaleX(1);
  }

  .search-pop-overlay, .sidebar-nav { display: none; }
  .sidebar-panel { display: block; }
  </style>
</noscript>

<link rel="alternate" href="/atom.xml" title="一年春又来" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">一年春又来</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/" rel="section"><i class="home                          //首页 fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="archive          //归档 fa-fw"></i>归档</a></li>
        <li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="th           //分类 fa-fw"></i>分类</a></li>
        <li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="tags                     //标签 fa-fw"></i>标签</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E7%90%86%E8%AE%BA"><span class="nav-text">1 理论</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-4-%E5%9E%83%E5%9C%BE%E6%94%B6%E9%9B%86%E7%AE%97%E6%B3%95"><span class="nav-text">1.4 垃圾收集算法</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-5-%E5%9E%83%E5%9C%BE%E6%94%B6%E9%9B%86%E5%99%A8"><span class="nav-text">1.5 垃圾收集器</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E5%B7%A5%E5%85%B7"><span class="nav-text">2 工具</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E5%AE%9E%E6%88%98"><span class="nav-text">3 实战</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-%E5%A4%A7%E5%86%85%E5%AD%98%E7%A1%AC%E4%BB%B6%E4%B8%8A%E7%9A%84%E7%A8%8B%E5%BA%8F%E9%83%A8%E7%BD%B2%E7%AD%96%E7%95%A5"><span class="nav-text">3.1 大内存硬件上的程序部署策略</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-%E9%9B%86%E7%BE%A4%E9%97%B4%E5%90%8C%E6%AD%A5%E5%AF%BC%E8%87%B4%E7%9A%84%E5%86%85%E5%AD%98%E6%BA%A2%E5%87%BA"><span class="nav-text">3.2 集群间同步导致的内存溢出</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3-%E5%A0%86%E5%A4%96%E5%86%85%E5%AD%98%E5%AF%BC%E8%87%B4%E7%9A%84%E6%BA%A2%E5%87%BA%E9%94%99%E8%AF%AF"><span class="nav-text">3.3 堆外内存导致的溢出错误</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-4-%E5%A4%96%E9%83%A8%E5%91%BD%E4%BB%A4%E5%AF%BC%E8%87%B4%E7%B3%BB%E7%BB%9F%E7%BC%93%E6%85%A2"><span class="nav-text">3.4 外部命令导致系统缓慢</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-5-%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%99%9A%E6%8B%9F%E6%9C%BA%E8%BF%9B%E7%A8%8B%E5%B4%A9%E6%BA%83"><span class="nav-text">3.5 服务器虚拟机进程崩溃</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-6-%E4%B8%8D%E6%81%B0%E5%BD%93%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E5%AF%BC%E8%87%B4%E5%86%85%E5%AD%98%E5%8D%A0%E7%94%A8%E8%BF%87%E5%A4%A7"><span class="nav-text">3.6 不恰当数据结构导致内存占用过大</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-7-%E7%94%B1Windows%E8%99%9A%E6%8B%9F%E5%86%85%E5%AD%98%E5%AF%BC%E8%87%B4%E7%9A%84%E9%95%BF%E6%97%B6%E9%97%B4%E5%81%9C%E9%A1%BF"><span class="nav-text">3.7 由Windows虚拟内存导致的长时间停顿</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-8-%E7%94%B1%E5%AE%89%E5%85%A8%E7%82%B9%E5%AF%BC%E8%87%B4%E9%95%BF%E6%97%B6%E9%97%B4%E5%81%9C%E9%A1%BF"><span class="nav-text">3.8 由安全点导致长时间停顿</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%E5%8F%82%E8%80%83%E8%B5%84%E6%BA%90"><span class="nav-text">4 参考资源</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">一年春又来</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">234</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">38</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">125</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://littlefxc.github.io/2021/02/23/docs/JVM/JVM-%E8%B0%83%E4%BC%98/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="一年春又来">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一年春又来">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          JVM 调优
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-02-23 20:49:45" itemprop="dateCreated datePublished" datetime="2021-02-23T20:49:45+08:00">2021-02-23</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2022-05-10 09:24:04" itemprop="dateModified" datetime="2022-05-10T09:24:04+08:00">2022-05-10</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/Java/" itemprop="url" rel="index"><span itemprop="name">Java</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <p>[TOC]</p>
<h2 id="1-理论"><a href="#1-理论" class="headerlink" title="1 理论"></a>1 理论</h2><p><a href="!--swig%EF%BF%BC1--">JVM-内存结构</a></p>
<p><a href="!--swig%EF%BF%BC2--">JVM-类文件结构</a></p>
<p><a href="!--swig%EF%BF%BC3--">JVM-类加载机制</a></p>
<p><a href="!--swig%EF%BF%BC4--">JVM-分代收集理论</a></p>
<p><a href="!--swig%EF%BF%BC5--">JVM-编译器优化</a></p>
<h3 id="1-4-垃圾收集算法"><a href="#1-4-垃圾收集算法" class="headerlink" title="1.4 垃圾收集算法"></a>1.4 垃圾收集算法</h3><h3 id="1-5-垃圾收集器"><a href="#1-5-垃圾收集器" class="headerlink" title="1.5 垃圾收集器"></a>1.5 垃圾收集器</h3><h2 id="2-工具"><a href="#2-工具" class="headerlink" title="2 工具"></a>2 工具</h2><p><a href="!--swig%EF%BF%BC6--">虚拟机性能监控故障处理工具</a></p>
<h2 id="3-实战"><a href="#3-实战" class="headerlink" title="3 实战"></a>3 实战</h2><h3 id="3-1-大内存硬件上的程序部署策略"><a href="#3-1-大内存硬件上的程序部署策略" class="headerlink" title="3.1 大内存硬件上的程序部署策略"></a>3.1 大内存硬件上的程序部署策略</h3><p>如果实际内存有16G，将<code>-Xmx</code>和<code>-Xms</code>参数将Java 堆大小固定为12G，程序运行一段时间后，会常常不定期出现长时间失去响应，程序中涉及将磁盘中的文档提取到内存中，这些大对象在分配时直接进入了老年代，没有在 Minor GC 中被清理掉，很快就造成了内存不够的现象导致程序每隔几分钟出现十几秒的停顿。</p>
<p>解决办法是堆内存重新缩小到1.5G或者2G。</p>
<p>每一款Java虚拟机中的每一款垃圾收集器都有自己的应用目标与最适合的应用场景，如果在特定 </p>
<p>场景中选择了不恰当的配置和部署方式，自然会事倍功半。目前单体应用在较大内存的硬件上主要的 </p>
<p>部署方式有两种：</p>
<ol>
<li><p>通过一个单独的Java虚拟机实例来管理大量的Java堆内存。</p>
</li>
<li><p>同时使用若干个Java虚拟机，建立逻辑集群来利用硬件资源。</p>
</li>
</ol>
<p><font color=red>控制Full GC频率的关键是老年代的相对稳定，这主要取决于应用中绝大多数对象能否符合“朝生夕灭”的原则，即大多数对象的生存时间不应当太长，尤其是不能有成批量的、长生存时间的大对象产 生，这样才能保障老年代空间的稳定。</font></p>
<p>如果要使用单个Java实例来管理大内存，还需考虑下面可能面临的问题：</p>
<ul>
<li><p>回收大块堆内存而导致的长时间停顿，自从G1收集器的出现，增量回收得到比较好的应用， </p>
<p>这个问题有所缓解，但要到ZGC和Shenandoah收集器成熟之后才得到相对彻底地解决。</p>
</li>
<li><p>大内存必须有64位Java虚拟机的支持，但由于压缩指针、处理器缓存行容量（Cache Line）等因素，64位虚拟机的性能测试结果普遍略低于相同版本的32位虚拟机。 </p>
</li>
<li><p>必须保证应用程序足够稳定，因为这种大型单体应用要是发生了堆内存溢出，几乎无法产生堆转储快照（要产生十几GB乃至更大的快照文件），哪怕成功生成了快照也难以进行分析；如果确实出了问题要进行诊断，可能就必须应用JMC这种能够在生产环境中进行的运维工具。 </p>
</li>
<li><p>相同的程序在64位虚拟机中消耗的内存一般比32位虚拟机要大，这是由于指针膨胀，以及数据类型对齐补白等因素导致的，可以开启（默认即开启）压缩指针功能来缓解。 </p>
</li>
</ul>
<h3 id="3-2-集群间同步导致的内存溢出"><a href="#3-2-集群间同步导致的内存溢出" class="headerlink" title="3.2 集群间同步导致的内存溢出"></a>3.2 集群间同步导致的内存溢出</h3><p>被集群共享的数据要使用类似JBossCache这种非集中式的集群缓存来同步的话，可以允许读操作频繁，因为数据在本地内存有一份副本，读取的动作不会耗费多少资源，但不应当有过于频繁 的写操作，会带来很大的网络同步的开销。</p>
<h3 id="3-3-堆外内存导致的溢出错误"><a href="#3-3-堆外内存导致的溢出错误" class="headerlink" title="3.3 堆外内存导致的溢出错误"></a>3.3 堆外内存导致的溢出错误</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">[org.eclipse.jetty.util.log] handle failed java.lang.OutOfMemoryError: <span class="keyword">null</span> </span><br><span class="line">    at sun.misc.Unsafe.allocateMemory(Native Method) </span><br><span class="line">    at java.nio.DirectByteBuffer.&lt;init&gt;(DirectByteBuffer.java:<span class="number">99</span>) </span><br><span class="line">    at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:<span class="number">288</span>) </span><br><span class="line">    at org.eclipse.jetty.io.nio.DirectNIOBuffer.&lt;init&gt; </span><br><span class="line">    ……</span><br></pre></td></tr></table></figure>

<p>直接内存（Direct Memory）并不是虚拟机运行时数据区的一部分，也不是《Java虚拟机规范》中定义的内存区域。但是这部分内存也被频繁的使用，而且也可能导致OutOfMemory异常出现。</p>
<p>在JDK 1.4中新加入了NIO（New Input/Output）类，引入了一种基于通道（Channel）与缓冲区（Buffer）的I/O方式，它可以使用Native函数库直接分配堆外内存，然后通过一个存储在Java堆里面的DirectByteBuffer对象作为这块内存的引用进行操作。这样能在一些场景中显著提高性能，因为避免了在Java堆和Native堆中来回复制数据。 </p>
<p>显然，本机直接内存的分配不会受到Java堆大小的限制，但是，既然是内存，则肯定还是会受到本机总内存（包括物理内存、SWAP分区或者分页文件）大小以及处理器寻址空间的限制，一般服务 器管理员配置虚拟机参数时，会根据实际内存去设置-Xmx等参数信息，但经常忽略掉直接内存，使得 各个内存区域总和大于物理内存限制（包括物理的和操作系统级的限制），从而导致动态扩展时出现 OutOfMemoryError异常。</p>
<h3 id="3-4-外部命令导致系统缓慢"><a href="#3-4-外部命令导致系统缓慢" class="headerlink" title="3.4 外部命令导致系统缓慢"></a>3.4 外部命令导致系统缓慢</h3><h3 id="3-5-服务器虚拟机进程崩溃"><a href="#3-5-服务器虚拟机进程崩溃" class="headerlink" title="3.5 服务器虚拟机进程崩溃"></a>3.5 服务器虚拟机进程崩溃</h3><h3 id="3-6-不恰当数据结构导致内存占用过大"><a href="#3-6-不恰当数据结构导致内存占用过大" class="headerlink" title="3.6 不恰当数据结构导致内存占用过大"></a>3.6 不恰当数据结构导致内存占用过大</h3><h3 id="3-7-由Windows虚拟内存导致的长时间停顿"><a href="#3-7-由Windows虚拟内存导致的长时间停顿" class="headerlink" title="3.7 由Windows虚拟内存导致的长时间停顿"></a>3.7 由Windows虚拟内存导致的长时间停顿</h3><h3 id="3-8-由安全点导致长时间停顿"><a href="#3-8-由安全点导致长时间停顿" class="headerlink" title="3.8 由安全点导致长时间停顿"></a>3.8 由安全点导致长时间停顿</h3><h2 id="4-参考资源"><a href="#4-参考资源" class="headerlink" title="4 参考资源"></a>4 参考资源</h2><p><a target="_blank" rel="noopener" href="https://www.cnblogs.com/andy-zhou/p/5327288.html">JVM调优总结</a></p>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/jvm/" rel="tag"># jvm</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2021/02/19/KAFKA-%E9%85%8D%E7%BD%AE%E5%8F%82%E6%95%B0%E8%AF%A6%E8%A7%A3/" rel="prev" title="KAFKA 配置参数详解">
                  <i class="fa fa-chevron-left"></i> KAFKA 配置参数详解
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2021/02/24/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95/" rel="next" title="设计模式学习记录">
                  设计模式学习记录 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>







<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      const activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      const commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">一年春又来</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/mist/" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>
<script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script>

  
<script src="/js/local-search.js"></script>






  





</body>
</html>
